<%@ page import="com.wuchao.service.serviceImpl.ServiceImpl" %>
<%@ page import="com.wuchao.entity.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: Root404
  Date: 2022/6/28
  Time: 10:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        span,h1,a{
            color: red;
            font-size: 33px;
        }
    </style>
</head>
<body>
<h1>欢迎来到主界面</h1>
<table border="3">
    <tr>
        <th>id</th>
        <th>name</th>
        <th>sex</th>
        <th>操作</th>
    </tr>
    <% ServiceImpl service = new ServiceImpl();
        List<User> list = service.findPoJo("select * from user");
        for(User user : list){%>
    <tr>
        <td><%=user.getId()%></td>
        <td><%=user.getName()%></td>
        <td><%=user.getSex()%></td>
        <td><%--<a href="controller.jsp?op=delete&id=<%=user.getId()%>">删除</a>--%>
            <a href="${pageContext.request.contextPath}/ServletController?op=delete&id=<%=user.getId()%>">删除</a>
            <a href="add.jsp">增加</a></td>
    </tr>
    <%  }
    %>
</table>
<span><%=request.getParameter("feifa")==null?"":"非法入侵"%></span>
<span><%=request.getParameter("isdelete1")==null?"":"删除成功"%></span>
<span><%=request.getParameter("isdelete2")==null?"":"删除失败"%></span>
<span><%=request.getParameter("isadd1")==null?"":"增加成功"%></span>
<span><%=request.getParameter("isadd2")==null?"":"增加失败"%></span>
<script src="../js/jquery.js"></script>
<script>
    $("tr").css("background-color","yellow");
    $("tr:odd").css("background-color","green");
</script>
</body>
</html>
